package com.dws.xchat.conf;

import javax.servlet.http.HttpServlet;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.dws.xchat.exception.UserException;

@ControllerAdvice
public class GlobalExceptionHandler {
	
	@ExceptionHandler(value=Exception.class)
	@ResponseBody
	public String handlerUserException(HttpServlet req,UserException userException){
		System.out.println("sssssssssssssss");
		return 	JSON.toJSONString(userException);
	}
}
